import { Link, Outlet, useLocation, useSelector } from "umi";
import BasicLayout from "./BasicLayout";
import LoginLayout from "./LoginLayout";
import { selectLayout } from "@/utils/selectLayout";
import Loading from "@/components/Loading";

export default function Layout() {
  const location = useLocation();
  const loading = useSelector((state: any) => state.loading);
  const Layout = {
    BasicLayout,
    LoginLayout,
  };
  console.log(location);
  const Container = Layout[selectLayout(location.pathname)];
  return (
    <div className="bg-gray-50 min-h-screen">
      <Container>
        <Loading show={loading.effects["user/login"]} />
        <Outlet />
      </Container>
    </div>
  );
}
